<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>飞云ERP</title>
    <link rel="stylesheet" href="css/index.css">
    <style>
        .el-header {
            background-color: #B3C0D1;
            color: #333;
            line-height: 60px;
        }

        .el-aside {
            color: #333;
        }
    </style>
</head>
<body>
<div id="app">
    <el-container style="height: 500px; border: 1px solid #eee">
        <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
            <el-menu v-for="fun in functions">
                <el-submenu :index="fun.id">
                    <template slot="title"><i :class="fun.icon"></i>{{fun.name}}</template>
                    <el-menu-item-group>
                        <el-menu-item v-for="cfun in fun.subFunctions" :index="cfun.id">
                           <a :href="cfun.url" target="content">{{cfun.name}}</a>
                        </el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
            </el-menu>
        </el-aside>

        <el-container>
            <el-header style="text-align: right; font-size: 12px">
                <el-dropdown>
                    <i class="el-icon-setting" style="margin-right: 15px"></i>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item>查看</el-dropdown-item>
                        <el-dropdown-item>新增</el-dropdown-item>
                        <el-dropdown-item>删除</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
                <span>王小虎</span>
            </el-header>

            <el-main>
                <iframe name="content" style="width: 100%;height: 100%;border: 0px"></iframe>
            </el-main>
        </el-container>
    </el-container>
</div>
<script src="js/vue.js"></script>
<script src="js/index.js"></script>
<script src="js/axios.min.js"></script>
<script src="js/qs.min.js"></script>
<script>
    new Vue({
       el:"#app",
       data(){
           return {
               functions:[] //菜单
           }
       },
        methods:{
           loadFunctions(){
               axios.get("/functions/username")
                   .then(value => {
                      this.functions = value.data;
                   });
           }
        },
        mounted(){
           //页面挂载完成后，加载菜单
           this.loadFunctions();
        }
    });
</script>
</body>
</html>